$(function() {
	var userType = $("#userType").val();
	if (userType != '3') {
		$(".isHide").hide();
	}
})

function editAccess(accessId) {
	var url = '/CMS/ownerAccessControl/updateAccessControlPage.ht';
	url = url + "?accessId=" + accessId;
	$.go(url, {
		dataType : 'html',
		beforeSend : function() {
			showProccessBar();
		},
		error : function() {
			hideProccessBar();
		},
		success : function(data, textStatus) {
			replaceDocument(url, data);
		}
	});

}

function add() {
	var url = '/CMS/ownerAccessControl/addAccessControlPage.ht';
	$.go(url, {
		dataType : 'html',
		beforeSend : function() {
			showProccessBar();
		},
		error : function() {
			hideProccessBar();
		},
		success : function(data, textStatus) {
			replaceDocument(url, data);
		}
	});
}

function deleteDoor(accessId, deviceNo) {
	var url = '/CMS/ownerAccessControl/deleteAccessControl.ht' + "?accessId=" + accessId + "&deviceNo=" + deviceNo;
	_confirm("确认删除该数据吗？", function() {
		$.ajax({
			type : 'post',
			url : url,
			dataType : 'json',
			beforeSend : showProccessBar,
			error : hideProccessBar,
			success : function(value) {
				var code = value.code;
				if (code == 0) {
					var url = '/CMS/ownerAccessControl/showList.ht';
					$.go(url, {
						dataType : 'html',
						error : function() {
							hideProccessBar();
						},
						success : function(data, textStatus) {
							replaceDocument(url, data);
						}
					});
				} else {
					_alert(value.message);
					hideProccessBar();
				}
			}

		});
	});
}

function checkForm() {
	/*
	if (!$("#search").val()) {
		_alert("请输入查询内容");
		return false;
	} else {
		return true;
	}
	*/
}